import 'package:flutter/material.dart';

class NewsPage extends StatefulWidget {
  const NewsPage({super.key});

  @override
  State<NewsPage> createState() => _NewsPageState();
}

class _NewsPageState extends State<NewsPage>
    with SingleTickerProviderStateMixin {
  //顶部导航
  late TabController _tabController;

  @override
  void initState() {
    super.initState();
    //初始化顶部导航控制器
    _tabController = TabController(length: 2, vsync: this);
    //监听_tabController改变,动态加载数据
    _tabController.addListener(() {
      if (_tabController.animation!.value == _tabController.index) {
        print(_tabController.index);
      }
    });
  }

  @override
  void dispose() {
    super.dispose();
    _tabController.dispose();
  }

  @override
  Widget build(BuildContext context) {
    return Scaffold(
        appBar: AppBar(title: const Text('大学生创业信息')),
        body: Scaffold(
            appBar: PreferredSize(
                //设置appbar高度
                preferredSize: const Size.fromHeight(40),
                child: AppBar(
                    elevation: 0.5, //tabbar底部阴影,
                    backgroundColor: Colors.white,
                    title: SizedBox(
                      height: 30, //修改tabbar高度
                      child: TabBar(
                        labelStyle: const TextStyle(fontSize: 17), //选中时字体
                        unselectedLabelStyle:
                            const TextStyle(fontSize: 16), //未选中时字体
                        indicatorColor: Colors.red, //底部指示器颜色
                        labelColor: Colors.red, //选中的颜色
                        unselectedLabelColor: Colors.black, //label未选中的颜色
                        indicatorSize: TabBarIndicatorSize.label, //指示器大小
                        controller: _tabController, //指示器导航
                        tabs: const [
                          Tab(
                            child: Text('校园创业'),
                          ),
                          Tab(
                            child: Text('社会创业'),
                          ),
                        ],
                      ),
                    ))),
            body: TabBarView(
              controller: _tabController,
              children: [
                ListView(
                  children: <Widget>[
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 任意门动画工作室"),
                                  Divider(),
                                  Text("类型：校园创业"),
                                  Divider(),
                                  Text("团队规模：10人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：工作室主要以学校课题为主，招募大一到大三对二维、三维动画，游戏建模感兴趣的在校学生，一起参与项目开发"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head1.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("动画1班任同学"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 动感三维工作室"),
                                  Divider(),
                                  Text("类型：校园创业"),
                                  Divider(),
                                  Text("团队规模：8人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：工作室主要成员是在校大学生，也有专业老师的指导，团队氛围融洽，如果你热爱三维动画可以加入我们。"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head2.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("永恩"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 田莓游戏工作室"),
                                  Divider(),
                                  Text("类型：校园创业"),
                                  Divider(),
                                  Text("团队规模：15人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：田莓是基于校园创业孵化园，历经三年师兄师姐呕心沥血努力经营的成果，目前与国内诸多游戏公司有合作，欢迎智勇双全的你加入我们！"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head3.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("诺克萨斯之手"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 动感三维工作室"),
                                  Divider(),
                                  Text("类型：校园创业"),
                                  Divider(),
                                  Text("团队规模：8人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：工作室主要成员是在校大学生，也有专业老师的指导，团队氛围融洽，如果你热爱三维动画可以加入我们。"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head4.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("追风少年"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                            aspectRatio: 20 / 9,
                            child: Image.network(
                              'https://www.itying.com/images/flutter/2.png',
                              fit: BoxFit.cover,
                            ),
                          ),
                          const ListTile(
                            leading: CircleAvatar(
                                backgroundImage: NetworkImage(
                                    'https://www.itying.com/images/flutter/2.png')),
                            title: Text("xxxxxxxx"),
                            subtitle: Text("xxxxxxxxxx"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                            aspectRatio: 20 / 9,
                            child: Image.network(
                              "https://www.itying.com/images/flutter/3.png",
                              fit: BoxFit.cover,
                            ),
                          ),
                          const ListTile(
                            leading: CircleAvatar(
                                backgroundImage: NetworkImage(
                                    'https://www.itying.com/images/flutter/3.png')),
                            title: Text("xxxxxxxx"),
                            subtitle: Text("xxxxxxxxxx"),
                          )
                        ],
                      ),
                    )
                  ],
                ),
                ListView(
                  children: <Widget>[
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 动感动漫"),
                                  Divider(),
                                  Text("类型：社会创业"),
                                  Divider(),
                                  Text("团队规模：100人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：团队主营二维动漫设计，工作氛围融洽，弹性工作制，有着团队大牛参与作品设计带你一起飞。"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head5.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("李青"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 特效大师"),
                                  Divider(),
                                  Text("类型：社会创业"),
                                  Divider(),
                                  Text("团队规模：50人"),
                                  Divider(),
                                  Text("团队介绍：团队招募热爱特效设计的你，欢迎加入特效大师大家庭。"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head6.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("牛头人酋长"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 梓龙游戏工作室"),
                                  Divider(),
                                  Text("类型：社会创业"),
                                  Divider(),
                                  Text("团队规模：200人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：梓龙是基于校园创业孵化园，历经三年师兄师姐呕心沥血努力经营的成果，目前与国内诸多游戏公司有合作，欢迎智勇双全的你加入我们！"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head7.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("曙光女神"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                              aspectRatio: 20 / 7,
                              child: ListView(
                                padding: const EdgeInsets.all(20),
                                children: const [
                                  Text("工作室： 三维空创"),
                                  Divider(),
                                  Text("类型：社会创业"),
                                  Divider(),
                                  Text("团队规模：8人"),
                                  Divider(),
                                  Text(
                                      "团队介绍：工作室主要成员是在校大学生，也有专业老师的指导，团队氛围融洽，如果你热爱三维动画可以加入我们。"),
                                  Divider(),
                                ],
                              )),
                          ListTile(
                            leading: ClipOval(
                              child: Image.asset("assets/images/head8.jpeg",
                                  fit: BoxFit.cover, height: 60, width: 60),
                            ),
                            title: const Text("不屈之枪"),
                            subtitle: const Text("地点：吉林动画学院"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                            aspectRatio: 20 / 9,
                            child: Image.network(
                              "https://www.itying.com/images/flutter/2.png",
                              fit: BoxFit.cover,
                            ),
                          ),
                          const ListTile(
                            leading: CircleAvatar(
                                backgroundImage: NetworkImage(
                                    'https://www.itying.com/images/flutter/2.png')),
                            title: Text("xxxxxxxx"),
                            subtitle: Text("xxxxxxxxxx"),
                          )
                        ],
                      ),
                    ),
                    Card(
                      elevation: 20,
                      shape: RoundedRectangleBorder(
                        borderRadius: BorderRadius.circular(10),
                      ),
                      margin: const EdgeInsets.all(10),
                      child: Column(
                        children: <Widget>[
                          AspectRatio(
                            aspectRatio: 20 / 9,
                            child: Image.network(
                              "https://www.itying.com/images/flutter/3.png",
                              fit: BoxFit.cover,
                            ),
                          ),
                          const ListTile(
                            leading: CircleAvatar(
                                backgroundImage: NetworkImage(
                                    'https://www.itying.com/images/flutter/3.png')),
                            title: Text("xxxxxxxx"),
                            subtitle: Text("xxxxxxxxxx"),
                          )
                        ],
                      ),
                    )
                  ],
                )
              ],
            )));
  }
}
